//
//  DDTNewFeatureViewCell.swift
//  weibo
//
//  Created by mac on 16/9/30.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit

class DDTNewFeatureViewCell: UICollectionViewCell {
    
    var imageIndex: Int? = 0 {
        didSet {
            backgroundImageView.image = UIImage(named: "new_feature_\(imageIndex! + 1)")
            
        }
    }
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    
    private func setupUI() {
        contentView.addSubview(backgroundImageView)
        backgroundImageView.backgroundColor = UIColor.brownColor()
        //约束
        backgroundImageView.translatesAutoresizingMaskIntoConstraints = false
        
        self.contentView.addConstraint(NSLayoutConstraint(item: backgroundImageView, attribute: .Top, relatedBy: .Equal, toItem: self.contentView, attribute: .Top, multiplier: 1, constant: 0))
        self.contentView.addConstraint(NSLayoutConstraint(item: backgroundImageView, attribute: .Leading, relatedBy: .Equal, toItem: self.contentView, attribute: .Leading, multiplier: 1, constant: 0))
        self.contentView.addConstraint(NSLayoutConstraint(item: backgroundImageView, attribute: .Bottom, relatedBy: .Equal, toItem: self.contentView, attribute: .Bottom, multiplier: 1, constant: 0))
        self.contentView.addConstraint(NSLayoutConstraint(item: backgroundImageView, attribute: .Trailing, relatedBy: .Equal, toItem: self.contentView, attribute: .Trailing, multiplier: 1, constant: 0))
        
    }
    
    /**
    *  懒加载
    */
    private lazy var backgroundImageView: UIImageView = UIImageView()
    
    
    /**
     *  懒加载 开始按钮
     */
    lazy var sharedButton: UIButton = {
        
        let button = UIButton()
        
        
        
        
        return button
    }()
    
}




